
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;



public partial class FindDialog
{

    public string Res = "Cancel";

    public FindDialog(FlowDocument document)
    {

        // This call is required by the designer.
        InitializeComponent();
        // Add any initialization after the InitializeComponent() call.

    }

    public void OKButton_Click(System.Object sender, RoutedEventArgs e)
    {
        Res = "OK";
        Close();
    }

    public void FindDialog_Loaded(object sender, RoutedEventArgs e)
    {
        if (MS.WindowsAPICodePack.Internal.CoreHelpers.RunningOnVista || MS.WindowsAPICodePack.Internal.CoreHelpers.RunningOnWin7)
        {
            AppHelper.ExtendGlassFrame(this, new Thickness(-1, -1, -1, -1));
        }
        TextBox1.Focus();
    }

    public void TextBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Enter)
        {
            if (OKButton.IsEnabled)
            {
                OKButton_Click(null, null);
            }
        }
    }

    public void TextBox1_TextChanged(object sender, TextChangedEventArgs e)
    {
        if (TextBox1.Text.Length > 0)
        {
            OKButton.IsEnabled = true;
        }
        else
        {
            OKButton.IsEnabled = false;
        }
    }
}

